import { Base } from '../../utils/base.js';

class Ycdetail extends Base {
  constructor() {
    super();
  }

  //小程序码
  get_qr_code(id, mid, _page, callBack) {
    var access_token = ''
    tt.request({
      url: 'https://developer.toutiao.com/api/apps/token?appid=tt31d3476eaee9295c&secret=082980c45f34ca696b71c7656b80c3e8db038a00&grant_type=client_credential', // 目标服务器url
      success: (res) => {
        console.log('123', res.data)
        access_token = res.data.access_token
        tt.request({
          url: 'https://developer.toutiao.com/api/apps/qrcode', // 目标服务器url
          method: 'POST',
          responseType: 'arraybuffer',//响应方式
          data: {
            "access_token": res.data.access_token,
            "appname": "douyin",
            "path": "pages/ycdetail/ycdetail?id="+id,
            "width": 280,
          },
          success: (res) => {
            let qrImg = "data:image/png;base64," + tt.arrayBufferToBase64(res.data)
            console.log(qrImg);
            callBack && callBack(qrImg);
          }
        });
      }
    });
  }
  //查询姓名手机号避免填写
  getinfo(callBack) {
    var params = {
      url: 'getinfo',
      sCallBack: function (res) {
        callBack && callBack(res);
      }
    };
    this.request(params);
  }

  getJQListArr(id, callBack) {
    var param = {
      url: 'getJQListArr3?aid=' + id,
      sCallBack: function (data) {
        callBack && callBack(data);
      }
    };
    this.request(param);
  }

  getinformation(id, callBack) {
    var param = {
      url: 'getinformation/' + id,
      sCallBack: function (data) {
        callBack && callBack(data);
      }
    };
    this.request(param);
  } //页面信息


  getDetailfint(id, callBack) {
    var param = {
      url: 'getDetailfint/' + id,
      sCallBack: function (data) {
        callBack && callBack(data);
      }
    };
    this.request(param);
  }

  getDaiDengJi(products, callBack) {
    var param = {
      url: 'getDaiDengJi',
      type: 'post',
      data: products,
      sCallBack: function (data) {
        console.log(data);
        callBack && callBack(data);
      }
    };
    this.request(param);
  }

  getKaiShou(products, callBack) {
    var param = {
      url: 'getKaiShou',
      type: 'post',
      data: products,
      sCallBack: function (data) {
        callBack && callBack(data);
      }
    };
    this.request(param);
  }

  getCotentfint(id, callBack) {
    var param = {
      url: 'getCotentfint/' + id,
      sCallBack: function (data) {
        callBack && callBack(data);
      }
    };
    this.request(param);
  }

  getYanZheng(id, callBack) {
    var param = {
      url: 'getYanZheng?aid=' + id,
      sCallBack: function (data) {
        callBack && callBack(data);
      }
    };
    this.request(param);
  }

  getShouCang(aid, title, addtime, typeid, callBack) {
    var param = {
      url: 'getShouCang?aid=' + aid + '&title=' + title + '&addtime=' + addtime + '&typeid=' + typeid,
      sCallBack: function (res) {
        //console.log(data);
        callBack && callBack(res);
      }
    }; //console.log(param);

    this.request(param);
  } //场馆


  getChangGuan(id, callBack) {
    var param = {
      url: 'getChangGuan/' + id,
      sCallBack: function (data) {
        //console.log(data);
        callBack && callBack(data);
      }
    }; //console.log(param);

    this.request(param);
  } //城市


  getChengshi(id, callBack) {
    var param = {
      url: 'getChengshi/' + id,
      sCallBack: function (data) {
        callBack && callBack(data);
      }
    };
    this.request(param);
  } //问答个数


  getQnums(id, callBack) {
    var param = {
      url: 'getQnums/' + id,
      sCallBack: function (data) {
        callBack && callBack(data);
      }
    };
    this.request(param);
  } //问答内容


  getAnswer(id, callBack) {
    var param = {
      url: 'getAnswer?id=' + id,
      sCallBack: function (data) {
        callBack && callBack(data);
      }
    };
    this.request(param);
  } //热门演出推荐


  getProject(id, callBack) {
    var param = {
      url: 'getProject/' + id,
      sCallBack: function (data) {
        callBack && callBack(data);
      }
    };
    this.request(param);
  } //热门演出推荐不够6个运行一下内容


  getProjeArr(id, callBack) {
    var param = {
      url: 'getProject2/' + id,
      sCallBack: function (data) {
        callBack && callBack(data);
      }
    };
    this.request(param);
  }

}

export { Ycdetail };